# -*- coding: utf-8 -*-
import sys

from image.news import News
from image.product import Product

"""
产品图片抓取
"""
if __name__ == '__main__':
    args = sys.argv
    if len(args) < 3:
        print(f'Usage: {args[0]} <type> <number>')
        exit(1)
    download_type = args[1]
    id = int(args[2])
    print(f'save {download_type} image start...')
    if download_type == 'news':
        obj = News(id)
    else:
        obj = Product(id)
    while True:
        if not obj.download():
            break
    print(f'save {download_type} image end...')
